package own.stu.jobgib.playown.alg.leetcode.editor.cn.demo;

public class Helper {

    public static int[][] format(String str) {
        // 移除外层括号并按], [分割
        String cleaned = str.substring(2, str.length() - 2);
        String[] pairs = cleaned.split("\\],\\[");

        int[][] result = new int[pairs.length][2];

        for (int i = 0; i < pairs.length; i++) {
            String[] numbers = pairs[i].split(",");
            result[i][0] = Integer.parseInt(numbers[0]);
            result[i][1] = Integer.parseInt(numbers[1]);
        }
        return result;
    }
}
